//
//  addCell.m
//  PaiQuan
//
//  Created by Mac on 16/7/7.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "addCell.h"
@interface addCell()


@end

@implementation addCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setupSubviews];
        [self setConstraints];
    }
    return self;
}
-(void)setupSubviews{
    [self.contentView addSubview:self.imgView];
    [self.contentView addSubview:self.titleLabel];
    
    [self.contentView addSubview:self.lineView];
}
-(void)setConstraints{
     [self.imgView makeConstraints:^(MASConstraintMaker *make) {
         make.left.equalTo(self.contentView.left).offset(RATIO(20));
         make.width.height.equalTo(RATIO(48));
         make.centerY.equalTo(self.contentView);
     }];
    
     [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
        
         make.left.equalTo(self.imgView.right).offset(RATIO(20));
         make.centerY.equalTo(self.imgView);
     }];
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.width.left.equalTo(self.contentView);
        make.height.equalTo(RATIO(1));
        make.bottom.equalTo(self.contentView.bottom);
       
        
    }];
    
    
    
    
}
+ (instancetype)cellWithTableView:(UITableView *)tableView {
    static NSString *cellId = @"cellID";
    addCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[addCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    return cell;
}
#pragma mark --懒加载
-(UIImageView*)imgView{
    if (!_imgView) {
        _imgView = [[UIImageView alloc] init];
        
    }
    return _imgView;
    
    
    
}
-(UIView*)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor whiteColor];
    }
    return _lineView;
    
    
    
    
}
-(UILabel*)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
    }
    return _titleLabel;
    
    
    
}


@end
